package com.cloud.admin.adapter.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Collections;
import java.util.List;

@Data
public class InstanceDTO {
    @JsonProperty("Node")
    private NodeDTO node;

    @JsonProperty("Service")
    private ServiceDTO service;

    @JsonProperty("Checks")
    private List<ChecksDTO> checks;

    @Data
    public static class NodeDTO {
        @JsonProperty("Node")
        private String node = "default";

        @JsonProperty("Address")
        private String address = "";
    }

    @Data
    public static class ServiceDTO {
        @JsonProperty("ID")
        private String id;

        @JsonProperty("Service")
        private String service;

        @JsonProperty("Address")
        private String address;

        @JsonProperty("Port")
        private Integer port;

        @JsonProperty("Tags")
        private List<String> tags = Collections.EMPTY_LIST;
    }

    @Data
    public static class ChecksDTO {
        @JsonProperty("Node")
        private String node = "default";

        @JsonProperty("Status")
        private String status = "passing";

        @JsonProperty("ServiceID")
        private String serviceID;

        @JsonProperty("ServiceName")
        private String serviceName;
    }
}